﻿using System;
using System.Data;
using DataAccessObject;
using EntityObject;
using SharedLibraries;
using SharedLibraries.Constants;
using ThangNM_LIB.FUNC;

namespace ThangNM
{
    public partial class _Default : System.Web.UI.Page
    {
        public ThangNM.PublicInterface.Home_New mtpHome;

        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                mtpHome = Master as ThangNM.PublicInterface.Home_New;
                mtpHome.setClearMsg();
                if (!IsPostBack)
                    BindData();
            }
            catch (Exception ex)
            {
                if (mtpHome != null)
                    mtpHome.setNotifications(ConstEx.FunctionSetMsg.ERROR, ex.Message, e.ToString());
            }
        }

        protected void BindData()
        {
            CategoryEO _CategoryEO = (new CategoryDAO()).SelectBy_sQueryString_sUrl("/", System.IO.Path.GetFileName(Request.Url.LocalPath));
            Commons.setSEO_ON_PAGE(Page, _CategoryEO, this.GetType());
            DataTable dt = (new CategoryDAO()).Category_Topic(ConstEx.TableID_C.Topic, StringEx.getArrayKey(_CategoryEO.FK_sTopicID));
            Topic_List_ShowUC1.setTitle("Nguyễn Mạnh Thắng - Đơn giản là chia sẻ");
            if (DataTableEx.DataTable_OK(dt) == false)
            {
                //Commons.setRedirect(Page, null);
                //Topic_List_ShowUC1.Visible = false;
                return;
            }
            Topic_List_ShowUC1.sUrlNavigator = FileNameByFunction.Danh_Muc_;
            Topic_List_ShowUC1.BindData(dt, null);
        }
    }
}